package com.circle.rest.core.common.model;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

import java.util.List;

/**
 * @program: 200221000010675
 * @description: 分页结果集
 * @author: 赵航
 * @create: 2019-03-04 15:43
 **/
@Data
public class PageResult<T> {
    private Long page = 1L;// 要查找第几页
    private Long pageSize = 15L;// 每页显示多少条
    private Integer totalPage = 0;// 总页数
    private Long totalRows = 0L;// 总记录数
    private List<T> rows;// 结果集

    public PageResult() {
    }

    public PageResult(Page<T> page) {
        this.setRows(page.getRecords());
        this.setTotalRows(page.getTotal());
        this.setPage(page.getCurrent());
        this.setPageSize(page.getSize());
    }
}
